<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:p="http://primefaces.org/ui">
    <h:head>
        <title>ProjectBase</title>
        <link rel="StyleSheet" type="text/css" href="styles.css" />
    </h:head>
    <h:body>
        <h1>ProjectBase</h1>
        <h2>Releases</h2>
        <h:form>
            <h:panelGrid columns="2">
                <h:outputText value="Project:" />                
	            <p:selectOneMenu value="#{releaseBean.projectName}" onchange="submit()" effectDuration="1" styleClass="selectOneMenu">
                    <f:selectItem itemLabel="--Select--" itemValue="" />
	                <f:selectItems value="#{projectBean.projects}" />
	            </p:selectOneMenu>
            </h:panelGrid>
            <p:dataTable value="#{releaseBean.releases}" var="release" rendered="#{not empty releaseBean.releases}" style="width: 500px">
                <p:column>
                    <f:facet name="header">
                        <h:outputText value="Name" />
                    </f:facet>
                    <h:commandLink value="#{release.name}" action="#{releaseBean.edit}">
                        <f:setPropertyActionListener target="#{releaseBean.release}" value="${release}" />
                    </h:commandLink>
                </p:column>
            </p:dataTable>
            <h:outputText value="No releases defined." rendered="#{not empty releaseBean.projectName and empty releaseBean.releases}" />
	        <br />
            <p:commandButton value="Add Release" action="#{releaseBean.add}" ajax="false" rendered="#{not empty releaseBean.projectName}" />
	    </h:form>
    </h:body>
</html>
